set(lapi_code 
	lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h 
	lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h 
	ltable.h lundump.h lvm.h)
	
set(lauxlib_code 
	lauxlib.c lua.h luaconf.h lauxlib.h)
	
set(lbaselib_code 
	lbaselib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(lcode_code 
	lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h 
	lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h 
	ldo.h lgc.h ltable.h)
	
set(ldblib_code 
	ldblib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(ldebug_code 
	ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h 
	llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h 
	ltm.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h)
	
set(ldo_code 
	ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h 
	ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h 
	lstring.h ltable.h lundump.h lvm.h)
	
set(ldump_code 
	ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h
	lzio.h lmem.h lundump.h)
	
set(lfunc_code 
	lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h 
	lmem.h lstate.h ltm.h lzio.h)
	
set(lgc_code 
	lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h 
	ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h)
	
set(linit_code 
	linit.c lua.h luaconf.h lualib.h lauxlib.h)
	
set(liolib_code 
	liolib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(llex_code 
	llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h 
	ltm.h lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h)
	
set(lmathlib_code 
	lmathlib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(lmem_code 
	lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h 
	ltm.h lzio.h lmem.h ldo.h)	

set(loadlib_code 
	loadlib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(lobject_code
	lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h
	ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h)
	
set(lopcodes_code 
	lopcodes.c lopcodes.h llimits.h lua.h luaconf.h)
	
set(loslib_code 
	loslib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(lparser_code 
	lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h
	lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h
	lfunc.h lstring.h lgc.h ltable.h)
	
set(lstate_code 
	lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h
	ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h)
	
set(lstring_code 
	lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h
	ltm.h lzio.h lstring.h lgc.h)
	
set(lstrlib_code 
	lstrlib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(ltable_code 
	ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h
	ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h)
	
set(ltablib_code 
	ltablib.c lua.h luaconf.h lauxlib.h lualib.h)
	
set(ltm_code 
	ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h
	lmem.h lstring.h lgc.h ltable.h)
	
set(lua_code 
	lua.c lua.h luaconf.h lauxlib.h lualib.h)	
	
set(luac_code 
	luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h
	lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h
	lundump.h)	
	
set(lundump_code 
	lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h 
	llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h 
	lundump.h)	
	
set(lvm_code 
	lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h
	lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h 
	lvm.h)	
	
set(lzio_code 
	lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h lzio.h)	
	
set(print_code 
	print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h 
	ltm.h lzio.h lmem.h lopcodes.h lundump.h)	
	
	

	
add_library(LibLua SHARED 
${lapi_code}
${lauxlib_code}
${lbaselib_code}
${lcode_code}
${ldblib_code}
${ldebug_code}
${ldo_code}
${ldump_code}
${lfunc_code}
${lgc_code}
${linit_code}
${liolib_code}
${llex_code}
${lmathlib_code}
${lmem_code}
${loadlib_code}
${lobject_code}
${lopcodes_code}
${loslib_code}
${lparser_code}
${lstate_code}
${lstring_code}
${lstrlib_code}
${ltable_code}
${ltablib_code}
${ltm_code}
${lundump_code}
${lvm_code}
${lzio_code}
${print_code})	

target_compile_definitions(LibLua PRIVATE LUA_BUILD_AS_DLL)


add_executable(Lua ${lua_code})
target_link_libraries(Lua LibLua)

add_executable(Luac 
	${luac_code} 
	${lapi_code}
	${lauxlib_code}
	${lbaselib_code}
	${lcode_code}
	${ldblib_code}
	${ldebug_code}
	${ldo_code}
	${ldump_code}
	${lfunc_code}
	${lgc_code}
	${linit_code}
	${liolib_code}
	${llex_code}
	${lmathlib_code}
	${lmem_code}
	${loadlib_code}
	${lobject_code}
	${lopcodes_code}
	${loslib_code}
	${lparser_code}
	${lstate_code}
	${lstring_code}
	${lstrlib_code}
	${ltable_code}
	${ltablib_code}
	${ltm_code}
	${lundump_code}
	${lvm_code}
	${lzio_code}
	${print_code})
target_link_libraries(Luac LibLua)
				